package xcmg.device.dao.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import xcmg.device.dao.entity.purchase.PurchaseInboundDetailDO;

import java.math.BigDecimal;
import java.util.List;

@Mapper
public interface PurchaseInboundDetailMapper {
    int deleteByPrimaryKey(String id);

    int insert(PurchaseInboundDetailDO record);

    PurchaseInboundDetailDO selectByPrimaryKey(String id);

    int updateByPrimaryKey(PurchaseInboundDetailDO record);

    int removeByOrderList(@Param("orderList") List<String> orderList, @Param("orgId") String orgId);

    List<PurchaseInboundDetailDO> findByOrder(@Param("purchaseInboundOrder") String purchaseInboundOrder, @Param("orgId") String orgId);

    List<PurchaseInboundDetailDO> findByOrderForLocationUser(@Param("purchaseInboundOrder") String purchaseInboundOrder, @Param("orgId") String orgId);

    PurchaseInboundDetailDO findByOrderAndMaterialNo(@Param("purchaseInboundOrder") String purchaseInboundOrder, @Param("materialNo") String materialNo, @Param("orgId") String orgId, @Param("rowNo") Integer rowNo);

    int updateSendQty(@Param("orgId")String orgId, @Param("sendQty")BigDecimal sendQty, @Param("purchaseRequestOrder") String purchaseRequestOrder, @Param("materialNo") String materialNo);

    int updateStatus(@Param("status") Integer status, @Param("billNo") String billNo,@Param("materialsNo") String materialsNo);

    int findNumByState(@Param("purchaseNo") String purchaseNo,@Param("inboundNo") String inboundNo,@Param("materialsNo") String materialsNo,@Param("orgId")String orgId);

    int updateRowNo(@Param("purchaseNo") String purchaseNo,@Param("rowNo") Integer rowNo,@Param("materialsNo") String materialsNo,@Param("orgId")String orgId);

    int updateBarcodeRowNo(@Param("purchaseNo") String purchaseNo,@Param("rowNo") Integer rowNo,@Param("materialsNo") String materialsNo,@Param("orgId")String orgId);

    int updateInboundOrderRowNo(@Param("purchaseNo") String purchaseNo,@Param("rowNo") Integer rowNo,@Param("materialsNo") String materialsNo,@Param("orgId")String orgId);

    int updateInboundRecordRowNo(@Param("purchaseNo") String purchaseNo,@Param("rowNo") Integer rowNo,@Param("materialsNo") String materialsNo,@Param("orgId")String orgId);
    
    List<PurchaseInboundDetailDO> findByOrdersAndMaterialNo(@Param("purchaseInboundOrder") String purchaseInboundOrder, @Param("materialNo") String materialNo, @Param("orgId") String orgId, @Param("rowNo") Integer rowNo);
}